package script.shell;

import java.io.IOException;
import java.text.ParseException;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.Calendar;
import java.util.TimeZone;

/**
 * @ClassName BackHome
 * @Description TODO
 * @Author wuzmf
 * @Date 2018/6/22 15:26
 * @Version 1.0
 **/
public class BackHome {

	public static void main(String[] args) {
		long goHome = goHome();
		System.out.print("You Can Go Home after " + goHome + " Minutes.");
	}

	public static long goHome(){
		long leftMin = 0;
		int backHomeHour = 17;
		int backHomeMin = 30;
		LocalDateTime nowDateTime = LocalDateTime.now();
		int nowYear = nowDateTime.getYear();
		int nowMonth = nowDateTime.getMonthValue();
		int nowDay = nowDateTime.getDayOfMonth();
		LocalDateTime backHomeTime = LocalDateTime
				.of(nowYear, nowMonth, nowDay, backHomeHour, backHomeMin);
		long year = ChronoUnit.YEARS.between(nowDateTime, backHomeTime);
		long month = ChronoUnit.MONTHS.between(nowDateTime, backHomeTime);
		long days = ChronoUnit.DAYS.between(nowDateTime, backHomeTime);
		leftMin = ChronoUnit.MINUTES.between(nowDateTime, backHomeTime);
		return leftMin;
	}
}
